import { defineStore } from "pinia"
import axios from "axios"
import { nanoid } from "nanoid"

export const useTalkStore =defineStore('talk',{

    actions:{
        
        async getMusic(){
            //发请求,连续解构赋值加重命名
            let {data}= await axios.get('https://api.uomg.com/api/rand.music')
            this.musicList.unshift(data)
    
        }
    },


    //存储数据的地方
    state(){
        return {
            musicList:[
                {code:'1',
                    data:{
                        name:'隔壁泰山',
                        url:'http:\/\/music.163.com\/song\/media\/outer\/url?id=862101001.mp3',
                        picur1:'http:\/\/p1.music.126.net\/pbT0ag5PXJwYzFJ7YklMCA==\/109951163386629013.jpg'
                    }
                },
            ]
        }
    }
})